'use client'
import { Button } from "antd";
import { startTask, stopTask, checkTask } from "./_utils";
import { useEffect, useState } from "react";
export default function ScheduledTaskPage() {
    const [status, setStatus] = useState<boolean>(false)
    useEffect(() => {
        checkTask().then(res => {
            setStatus(res)
        })
        // console.log(taskIinstance);
        // startTask()
    }, [])
    return <div className="p-4">
        <h1 className=" text-center">定时任务配置</h1>
        {status ? <Button onClick={async () => {
            stopTask()
            setStatus(false)
        }}>停止任务</Button> : <Button onClick={() => {
            startTask()
            setStatus(true)
        }}>开始任务</Button>}

    </div>
}